/**
 */
package mvc_generator.mVCGenerator.impl;

import mvc_generator.mVCGenerator.ExpressionValidator;
import mvc_generator.mVCGenerator.MVCGeneratorPackage;
import mvc_generator.mVCGenerator.Page;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Expression Validator</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link mvc_generator.mVCGenerator.impl.ExpressionValidatorImpl#getExpressionName <em>Expression Name</em>}</li>
 *   <li>{@link mvc_generator.mVCGenerator.impl.ExpressionValidatorImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link mvc_generator.mVCGenerator.impl.ExpressionValidatorImpl#getPageOnSuccess <em>Page On Success</em>}</li>
 *   <li>{@link mvc_generator.mVCGenerator.impl.ExpressionValidatorImpl#getPageOnError <em>Page On Error</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ExpressionValidatorImpl extends MinimalEObjectImpl.Container implements ExpressionValidator
{
  /**
   * The default value of the '{@link #getExpressionName() <em>Expression Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getExpressionName()
   * @generated
   * @ordered
   */
  protected static final String EXPRESSION_NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getExpressionName() <em>Expression Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getExpressionName()
   * @generated
   * @ordered
   */
  protected String expressionName = EXPRESSION_NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDescription()
   * @generated
   * @ordered
   */
  protected static final String DESCRIPTION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDescription()
   * @generated
   * @ordered
   */
  protected String description = DESCRIPTION_EDEFAULT;

  /**
   * The cached value of the '{@link #getPageOnSuccess() <em>Page On Success</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPageOnSuccess()
   * @generated
   * @ordered
   */
  protected Page pageOnSuccess;

  /**
   * The cached value of the '{@link #getPageOnError() <em>Page On Error</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPageOnError()
   * @generated
   * @ordered
   */
  protected Page pageOnError;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ExpressionValidatorImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MVCGeneratorPackage.Literals.EXPRESSION_VALIDATOR;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getExpressionName()
  {
    return expressionName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setExpressionName(String newExpressionName)
  {
    String oldExpressionName = expressionName;
    expressionName = newExpressionName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.EXPRESSION_VALIDATOR__EXPRESSION_NAME, oldExpressionName, expressionName));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDescription()
  {
    return description;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDescription(String newDescription)
  {
    String oldDescription = description;
    description = newDescription;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.EXPRESSION_VALIDATOR__DESCRIPTION, oldDescription, description));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Page getPageOnSuccess()
  {
    if (pageOnSuccess != null && pageOnSuccess.eIsProxy())
    {
      InternalEObject oldPageOnSuccess = (InternalEObject)pageOnSuccess;
      pageOnSuccess = (Page)eResolveProxy(oldPageOnSuccess);
      if (pageOnSuccess != oldPageOnSuccess)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_SUCCESS, oldPageOnSuccess, pageOnSuccess));
      }
    }
    return pageOnSuccess;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Page basicGetPageOnSuccess()
  {
    return pageOnSuccess;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPageOnSuccess(Page newPageOnSuccess)
  {
    Page oldPageOnSuccess = pageOnSuccess;
    pageOnSuccess = newPageOnSuccess;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_SUCCESS, oldPageOnSuccess, pageOnSuccess));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Page getPageOnError()
  {
    if (pageOnError != null && pageOnError.eIsProxy())
    {
      InternalEObject oldPageOnError = (InternalEObject)pageOnError;
      pageOnError = (Page)eResolveProxy(oldPageOnError);
      if (pageOnError != oldPageOnError)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_ERROR, oldPageOnError, pageOnError));
      }
    }
    return pageOnError;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Page basicGetPageOnError()
  {
    return pageOnError;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPageOnError(Page newPageOnError)
  {
    Page oldPageOnError = pageOnError;
    pageOnError = newPageOnError;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_ERROR, oldPageOnError, pageOnError));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__EXPRESSION_NAME:
        return getExpressionName();
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__DESCRIPTION:
        return getDescription();
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_SUCCESS:
        if (resolve) return getPageOnSuccess();
        return basicGetPageOnSuccess();
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_ERROR:
        if (resolve) return getPageOnError();
        return basicGetPageOnError();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__EXPRESSION_NAME:
        setExpressionName((String)newValue);
        return;
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__DESCRIPTION:
        setDescription((String)newValue);
        return;
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_SUCCESS:
        setPageOnSuccess((Page)newValue);
        return;
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_ERROR:
        setPageOnError((Page)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__EXPRESSION_NAME:
        setExpressionName(EXPRESSION_NAME_EDEFAULT);
        return;
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__DESCRIPTION:
        setDescription(DESCRIPTION_EDEFAULT);
        return;
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_SUCCESS:
        setPageOnSuccess((Page)null);
        return;
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_ERROR:
        setPageOnError((Page)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__EXPRESSION_NAME:
        return EXPRESSION_NAME_EDEFAULT == null ? expressionName != null : !EXPRESSION_NAME_EDEFAULT.equals(expressionName);
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__DESCRIPTION:
        return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_SUCCESS:
        return pageOnSuccess != null;
      case MVCGeneratorPackage.EXPRESSION_VALIDATOR__PAGE_ON_ERROR:
        return pageOnError != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (expressionName: ");
    result.append(expressionName);
    result.append(", description: ");
    result.append(description);
    result.append(')');
    return result.toString();
  }

} //ExpressionValidatorImpl
